package com.uh.checking.filter;

import java.io.File;
import java.io.FilenameFilter;

public class IncludeMatchFilter implements FilenameFilter {

    private String ext;

    private String prefix;

    // constructor takes string argument
    public IncludeMatchFilter(String prefix, String ext) {
        this.ext = "." + ext;
        this.prefix = prefix;
    }

    @Override
    public boolean accept(File dir, String name) {
        return name.endsWith(this.ext) && name.startsWith(this.prefix);
    }
}
